Skip to content

Conversation

@askhade
Copy link
Contributor

@askhade askhade commented Dec 7, 2018

Adding implementation for new op-9 operator eyelike

@askhade askhade requested a review from a team December 7, 2018 00:13
9,
KernelDefBuilder().TypeConstraint("T1",
std::vector<MLDataType>{
DataTypeImpl::GetTensorType<float>(),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the entire list of supported types as per ONNX spec... should I add all of them?
tensor(float16), tensor(float), tensor(double), tensor(int8), tensor(int16), tensor(int32), tensor(int64), tensor(uint8), tensor(uint16), tensor(uint32), tensor(uint64), tensor(bool)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could add the types step by step based on requirement. Is there any models require other types?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if any model actually needs this operator right now. I am adding this as part of OP9 support. Do we maintain this info somewhere? How do I check?

Copy link
Contributor

@duli2012 duli2012 Dec 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By default, we start with tensor(float) and add other types if need be.

Copy link
Contributor

@pranavsharma pranavsharma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you look into Eigen? They support Nd matrices and operations on them.

public:
EyeLike(const OpKernelInfo& info) : OpKernel(info) {
if (!info.GetAttr("k", &k_).IsOK()) {
ONNXRUNTIME_THROW("Missing 'k' attribute value");
Copy link
Contributor

@pranavsharma pranavsharma Dec 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like 'k' is optional based on the spec in which case we don't have to throw. #Resolved

souptc
souptc previously approved these changes Dec 7, 2018
9,
KernelDefBuilder().TypeConstraint("T1",
std::vector<MLDataType>{
DataTypeImpl::GetTensorType<float>(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could add the types step by step based on requirement. Is there any models require other types?

input_dims[1]);
output_mat.setZero();

if ((k_ >= 0 && k_ >= input_dims[1]) || (k_ < 0 && std::abs(k_) >= input_dims[0])) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this an error condition?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really an error. If K is greater than row(for lower diag) or col (in case of upper diag) then we terminate early and return a tensor with all zeroes.

@askhade askhade merged commit 6169f3c into master Dec 7, 2018
@askhade askhade deleted the askhade/implement_eyelike branch December 7, 2018 18:17
TedThemistokleous pushed a commit to TedThemistokleous/onnxruntime that referenced this pull request Jul 9, 2025
* Add null check for node arguments.

* Add null check to Shape property of node arg.
quic-ankus pushed a commit to CodeLinaro/onnxruntime that referenced this pull request Nov 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants